home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
s-gikan2.maizuru-ct.ac.jp
/
s-gikan2.maizuru-ct.ac.jp.zip
/
s-gikan2.maizuru-ct.ac.jp
/
pub
/
ncvc352a_install.exe
/
{app}
/
scripts
/
convert_to_milimerter.pl
< prev
next >
Wrap
Perl Script
|
2012-09-10
|
1KB
|
43 lines
#! /usr/bin/perl
# NCâfü[â^Æåé╠ÉöÆlé╔żÉöô_é¬é┬éóé─éóé╚éóÅΩìçüA #
# 1/1000ö{é╡é╜Ælé╔ò╧è╖é╡é─żÉöô_é≡òtë┴é╖éΘâXâNâèâvâg #
# æ╬Å█é╠âAâhâîâX(É▌ÆΦë┬ö\)é╠îπé╠ÉöÆlé¬æ╬Å█é╞é╚éΘ #
# ex. X500Y80Z30. -> X0.5Y0.08Z30. #
########################################################
# æ╬Å█é╞é╖éΘâAâhâîâXé≡ÿAæ▒é┼ïLÅqé╡é─é¡é╛é│éó
#ex. XYZIJKRCUVW
$TARGET_ADDRESS = 'XYZIJKRCUVW';
########################################################
$pre_file= $ARGV[0];
$out_file= $ARGV[1];
open(IN,$pre_file);
open(OUT,">$out_file");
while(<IN>){
$new_line= "";
$comment_line = "";
while(/\(.*\)\s*/){
$comment_line = $comment_line . $&;
$_ = $`.$';
}
while(/([$TARGET_ADDRESS])([\-\d\.]+)/){
($pre_line,$char,$num,$_)= ($`,$1,$2,$');
if($num !~ /\./){
$num= int($num*1000)/1000000;
if($num !~ /\./ and $num != 0){ $num= $num."\."; }
}
$new_line= $new_line.$pre_line.$char.$num;
}
$_= $new_line.$_.$comment_line;
print OUT;
}